<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <!-- 满足有些用户在手机端访问的需要 -->

    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">

    <title>用户管理</title>
    <!-- 线上环境 -->
    <link rel="stylesheet" href="/static/css/dist/component-min.css">
    <link rel="stylesheet" href="/static/plugins/jbox/jbox-min.css">

    <!--vue-->
    <script src="/static/vue/vue.js"></script>
    <!--element ui-->
    <script src="/static/element/index.js"></script>
    <link rel="stylesheet" href="/static/element/index.css">
    <style>
        .el-table__empty-block {
            height: 0;
        }
    </style>

</head>
<body class="cp-bodybox">
<div id="app">
    <#include "/common/header-fg.html" />

    <div class="container">
        <div class="inner clearfix">
            <#include "/common/left-menu-fg.html" />

            <div class="content-right">
                <h1 class="content-right-title">客户详情</h1>
                <el-card class="box-card" style="margin-bottom: 10px">
                    <el-form :model="detail" label-width="160px">
                        <el-row>
                            <el-col :span="8">
                                <el-form-item label="昵称">{{detail.nick}}</el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item label="手机号码">{{detail.tel}}</el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item label="性别">{{detail.sex === 1 ? "男" : "女"}}</el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="8">
                                <el-form-item label="上级客户昵称">{{detail.lastOrg}}</el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item label="上级客户手机号">{{detail.higherCustomerTel}}</el-form-item>
                            </el-col>
                            <el-col :span="8">
                                <el-form-item label="是否会员">{{detail.vip === 0 ? "否" : "是"}}</el-form-item>
                            </el-col>
                        </el-row>
                    </el-form>
                </el-card>
                <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
                    <el-tab-pane label="详细资料" name="info" v-if="isPermission('customer:viewDetail', user.permissions)">
                        <div style="height: auto">
                            <el-row :gutter="10">
                                <el-col :span="12">
                                    <el-card class="box-card" style="height: 446px">
                                        <el-form>
                                            <el-row>
                                                <el-col :span="12">
                                                    <el-row>
                                                        <el-form-item label="微信标示:">{{info.identify}}</el-form-item>
                                                    </el-row>
                                                    <el-row>
                                                        <el-form-item label="积分:">{{info.point}}</el-form-item>
                                                    </el-row>
                                                    <el-row>
                                                        <el-form-item label="余额:">{{info.balance}}</el-form-item>
                                                    </el-row>
                                                    <el-row>
                                                        <el-form-item label="下级客户数:">{{info.subcount}}</el-form-item>
                                                    </el-row>
                                                </el-col>
                                                <el-col :span="12">
                                                    <div style="width: 200px;height: 200px;">
                                                        <img v-if="imgUrl !== ''" height="200" :src="imgUrl">
                                                    </div>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col :span="12">
                                                    <el-form-item label="消费总额:">{{info.dealAmount}}</el-form-item>
                                                </el-col>
                                                <el-col :span="12">
                                                    <el-form-item label="积分兑换剩余次数:">{{info.countPointExchangeBalance}}</el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-col :span="12">
                                                    <el-form-item label="消费次数:">{{info.dealTimes}}</el-form-item>
                                                </el-col>
                                                <el-col :span="12">
                                                    <el-form-item label="余额提现次数:">{{info.countBalanceToCash}}</el-form-item>
                                                </el-col>
                                            </el-row>
                                            <el-row>
                                                <el-form-item label="注册时间:">{{info.regTime}}</el-form-item>
                                            </el-row>
                                        </el-form>
                                    </el-card>
                                </el-col>
                                <el-col :span="12">
                                    <el-card class="box-card" style="height: 446px">
                                        <el-tabs v-model="activeName1" type="border-card" @tab-click="handleClick1">
                                            <el-tab-pane label="联系地址" name="second" v-if="isPermission('customer:viewAddr', user.permissions)">
                                                <el-table
                                                        :data="contactsList"
                                                        border
                                                        style="width: 100%">
                                                    <el-table-column
                                                            type="index"
                                                            label="序号"
                                                            width="80">
                                                    </el-table-column>
                                                    <el-table-column
                                                            prop="linkName"
                                                            label="联系人姓名"
                                                            width="180">
                                                    </el-table-column>
                                                    <el-table-column
                                                            prop="linkTel"
                                                            label="手机号码">
                                                    </el-table-column>
                                                    <el-table-column
                                                            prop="address"
                                                            show-overflow-tooltip
                                                            label="详细地址">
                                                    </el-table-column>
                                                    <el-table-column
                                                            prop="typeName"
                                                            label="地址类型">
                                                    </el-table-column>
                                                </el-table>
                                                <el-pagination
                                                        @current-change="handleAddress"
                                                        :current-page="addressCurrentPage"
                                                        :page-size="addressPageSize"
                                                        layout="total, prev, pager, next"
                                                        :total="addressTotalCount">
                                                </el-pagination>
                                            </el-tab-pane>
                                            <el-tab-pane label="客户关系链" name="third" v-if="isPermission('customer:viewRela', user.permissions)">
                                                <el-table
                                                        :data="mentionsList"
                                                        border
                                                        style="width: 100%">
                                                    <el-table-column
                                                            type="index"
                                                            label="序号"
                                                            width="80">
                                                    </el-table-column>
                                                    <el-table-column
                                                            prop="relation"
                                                            label="关系类型"
                                                            width="180">
                                                    </el-table-column>
                                                    <el-table-column
                                                            prop="name"
                                                            label="客户姓名">
                                                    </el-table-column>
                                                    <el-table-column
                                                            prop="birthday"
                                                            show-overflow-tooltip
                                                            :formatter="formatterBirth"
                                                            label="生日">
                                                    </el-table-column>
                                                    <el-table-column
                                                            prop="insertTime"
                                                            :formatter="formatterTime"
                                                            label="建立日期">
                                                    </el-table-column>
                                                </el-table>
                                                <el-pagination
                                                        @current-change="handleMentions"
                                                        :current-page="mentionsCurrentPage"
                                                        :page-size="mentionsPageSize"
                                                        layout="total, prev, pager, next"
                                                        :total="mentionsTotalCount">
                                                </el-pagination>
                                            </el-tab-pane>
                                        </el-tabs>
                                    </el-card>
                                </el-col>
                            </el-row>
                        </div>
                    </el-tab-pane>
                    <el-tab-pane label="积分明细" name="point" v-if="isPermission('customer:viewPoint', user.permissions)">
                        <el-card class="box-card">
                            <el-form :model="pointsForm" label-width="80px">
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="操作时间">
                                            <el-date-picker
                                                    v-model="pointsForm.from"
                                                    type="date"
                                                    placeholder="选择日期">
                                            </el-date-picker>&nbsp;至&nbsp;
                                            <el-date-picker
                                                    v-model="pointsForm.to"
                                                    type="date"
                                                    placeholder="选择日期">
                                            </el-date-picker>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="类型">
                                            <el-select v-model="pointsForm.type" placeholder="请选择类型">
                                                <el-option
                                                        v-for="item in pointsTypeList"
                                                        :label="item.name"
                                                        :value="item.value">
                                                </el-option>
                                            </el-select>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <div style="text-align: right">
                                        <el-button type="primary" @click.native.prevent="getPoints">查询</el-button>
                                        <el-button @click.native.prevent="clearPoints">清空查询条件</el-button>
                                    </div>
                                </el-row>
                            </el-form>
                        </el-card>
                        <el-button type="primary" style="margin: 10px 0;" v-if="isPermission('customer:viewPointSend', user.permissions)" @click.native.prevent="presentPointDialog = true">赠送</el-button>
                        <el-card class="box-card">
                            <el-table
                                    :data="pointsList"
                                    border
                                    style="width: 100%">
                                <el-table-column
                                        inline-template
                                        label="序号"
                                        align="center"
                                        width="80">
                                    <div>{{ $index+pointsPageSize*(pointsCurrentPage-1)+1 }}</div>
                                </el-table-column>
                                <el-table-column
                                        prop="typeName"
                                        align="center"
                                        label="来源/用途"
                                        width="180">
                                </el-table-column>
                                <el-table-column
                                        inline-template
                                        align="center"
                                        label="积分变化">
                                    <div>{{row.operateType === 1 ? "+" : "-"}}{{row.point}}</div>
                                </el-table-column>
                                <el-table-column
                                        prop="insertTime"
                                        align="center"
                                        show-overflow-tooltip
                                        label="时间">
                                </el-table-column>
                                <el-table-column
                                        prop="bizDesc"
                                        label="备注">
                                </el-table-column>
                            </el-table>
                            <el-pagination
                                    @current-change="handlePoints"
                                    :current-page="pointsCurrentPage"
                                    :page-size="pointsPageSize"
                                    layout="total, prev, pager, next"
                                    :total="pointsTotalCount">
                            </el-pagination>
                        </el-card>
                    </el-tab-pane>
                    <el-tab-pane label="余额明细" name="balance" v-if="isPermission('customer:viewBalance', user.permissions)">
                        <el-card class="box-card">
                            <el-form :inline="true" label-width="80px">
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="操作时间">
                                            <el-date-picker
                                                    v-model="balanceForm.from"
                                                    type="date"
                                                    placeholder="选择日期">
                                            </el-date-picker>&nbsp;至&nbsp;
                                            <el-date-picker
                                                    v-model="balanceForm.to"
                                                    type="date"
                                                    placeholder="选择日期">
                                            </el-date-picker>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="类型">
                                            <el-select v-model="balanceForm.type" placeholder="请选择类型">
                                                <el-option
                                                        v-for="item in balanceTypeList"
                                                        :label="item.name"
                                                        :value="item.value">
                                                </el-option>
                                            </el-select>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <div style="text-align: right">
                                        <el-button type="primary" @click.native.prevent="getBalance">查询</el-button>
                                        <el-button @click.native.prevent="clearBalance">清空查询条件</el-button>
                                    </div>
                                </el-row>
                            </el-form>
                        </el-card>
                        <el-card class="box-card" style="margin-top: 10px">
                            <el-table
                                    :data="balanceList"
                                    border
                                    style="width: 100%">
                                <el-table-column
                                        inline-template
                                        label="序号"
                                        width="80">
                                    <div>{{ $index+balancePageSize*(balanceCurrentPage-1)+1 }}</div>
                                </el-table-column>
                                <el-table-column
                                        prop="typeName"
                                        label="来源/用途"
                                        width="180">
                                </el-table-column>
                                <el-table-column
                                        prop="amount"
                                        label="余额变化"
                                        :formatter="formatterAmount">
                                </el-table-column>
                                <el-table-column
                                        prop="operateTime"
                                        show-overflow-tooltip
                                        label="时间">
                                </el-table-column>
                                <el-table-column
                                        prop="desc"
                                        label="备注">
                                </el-table-column>
                            </el-table>
                            <el-pagination
                                    @current-change="handleBalance"
                                    :current-page="balanceCurrentPage"
                                    :page-size="balancePageSize"
                                    layout="total, prev, pager, next"
                                    :total="balanceTotalCount">
                            </el-pagination>
                        </el-card>
                    </el-tab-pane>
                    <el-tab-pane label="提现记录" name="cash" v-if="isPermission('customer:viewFetch', user.permissions)">
                        <el-card class="box-card">
                            <el-form :inline="true" label-width="80px">
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="操作时间">
                                            <el-date-picker
                                                    v-model="cashForm.from"
                                                    type="date"
                                                    placeholder="选择日期">
                                            </el-date-picker>&nbsp;至&nbsp;
                                            <el-date-picker
                                                    v-model="cashForm.to"
                                                    type="date"
                                                    placeholder="选择日期">
                                            </el-date-picker>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="状态">
                                            <el-select v-model="cashForm.status" placeholder="请选择状态">
                                                <el-option
                                                        v-for="item in cashTypeList"
                                                        :label="item.name"
                                                        :value="item.value">
                                                </el-option>
                                            </el-select>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <div style="text-align: right">
                                        <el-button type="primary" @click.native.prevent="getCash">查询</el-button>
                                        <el-button  @click.native.prevent="clearCash">清空查询条件</el-button>
                                    </div>
                                </el-row>
                            </el-form>
                        </el-card>
                        <el-card class="box-card" style="margin-top: 10px">
                            <el-table
                                    :data="cashList"
                                    border
                                    style="width: 100%">
                                <el-table-column
                                        inline-template
                                        label="序号"
                                        width="80">
                                    <div>{{ $index+cashPageSize*(cashCurrentPage-1)+1 }}</div>
                                </el-table-column>
                                <el-table-column
                                        prop="realAmount"
                                        label="金额(元)"
                                        width="180">
                                </el-table-column>
                                <el-table-column
                                        prop="statusName"
                                        label="状态">
                                </el-table-column>
                                <el-table-column
                                        prop="completeTime"
                                        label="时间">
                                </el-table-column>
                                <el-table-column
                                        align="center"
                                        label="操作"
                                        inline-template>
                                    <div style="margin-left: -10px">
                                        <el-button size="small" type="primary" class="el-icon-delete">审核</el-button>
                                    </div>
                                </el-table-column>
                            </el-table>
                            <el-pagination
                                    @current-change="handleCash"
                                    :current-page="cashCurrentPage"
                                    :page-size="cashPageSize"
                                    layout="total, prev, pager, next"
                                    :total="cashTotalCount">
                            </el-pagination>
                        </el-card>
                    </el-tab-pane>
                    <el-tab-pane label="签到记录" name="signed" v-if="isPermission('customer:viewSign', user.permissions)">
                        <el-card class="box-card">
                            <el-form :inline="true" label-width="80px">
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="操作时间">
                                            <el-date-picker
                                                    v-model="signedForm.from"
                                                    type="date"
                                                    placeholder="选择日期">
                                            </el-date-picker>&nbsp;至&nbsp;
                                            <el-date-picker
                                                    v-model="signedForm.to"
                                                    type="date"
                                                    placeholder="选择日期">
                                            </el-date-picker>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <div style="text-align: right">
                                            <el-button type="primary" @click.native.prevent="getSigned">查询</el-button>
                                            <el-button @click.native.prevent="clearSigned">清空查询条件</el-button>
                                        </div>
                                    </el-col>
                                </el-row>
                            </el-form>
                        </el-card>
                        <el-card class="box-card" style="margin-top: 10px">
                            <el-table
                                    :data="signList"
                                    border
                                    style="width: 100%">
                                <el-table-column
                                        inline-template
                                        label="序号"
                                        width="80">
                                    <div>{{ $index+signedPageSize*(signedCurrentPage-1)+1 }}</div>
                                </el-table-column>
                                <el-table-column
                                        prop="startTime"
                                        label="签到开始时间">
                                </el-table-column>
                                <el-table-column
                                        prop="count"
                                        label="连续签到天数">
                                </el-table-column>
                            </el-table>
                            <el-pagination
                                    @current-change="handleSigned"
                                    :current-page="signedCurrentPage"
                                    :page-size="signedPageSize"
                                    layout="total, prev, pager, next"
                                    :total="signedTotalCount">
                            </el-pagination>
                        </el-card>
                    </el-tab-pane>
                    <el-tab-pane label="抽奖记录" name="lottery" v-if="isPermission('customer:viewLottery', user.permissions)">
                        <el-card class="box-card">
                            <el-form :inline="true" label-width="80px">
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="操作时间">
                                            <el-date-picker
                                                    v-model="lotteryForm.from"
                                                    type="date"
                                                    placeholder="选择日期">
                                            </el-date-picker>&nbsp;至&nbsp;
                                            <el-date-picker
                                                    v-model="lotteryForm.to"
                                                    type="date"
                                                    placeholder="选择日期">
                                            </el-date-picker>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <div style="text-align: right">
                                            <el-button type="primary" @click.native.prevent="getLottery">查询</el-button>
                                            <el-button @click.native.prevent="clearLottery">清空查询条件</el-button>
                                        </div>
                                    </el-col>
                                </el-row>
                            </el-form>
                        </el-card>
                        <el-card class="box-card" style="margin-top: 10px">
                            <el-table
                                    :data="lotteryList"
                                    border
                                    style="width: 100%">
                                <el-table-column
                                        inline-template
                                        label="序号"
                                        width="80">
                                    <div>{{ $index+lotteryPageSize*(lotteryCurrentPage-1)+1 }}</div>
                                </el-table-column>
                                <el-table-column
                                        prop="joinTime"
                                        label="抽奖时间">
                                </el-table-column>
                                <el-table-column
                                        prop="activityName"
                                        label="抽奖活动">
                                </el-table-column>
                                <el-table-column
                                        inline-template
                                        label="是否中奖">
                                    <div>{{row.isWin === 1 ? "是" : "否"}}</div>
                                </el-table-column>
                                <el-table-column
                                        prop="lotteryItemName"
                                        label="奖项">
                                </el-table-column>
                            </el-table>
                            <el-pagination
                                    @current-change="handleLottery"
                                    :current-page="lotteryCurrentPage"
                                    :page-size="lotteryPageSize"
                                    layout="total, prev, pager, next"
                                    :total="lotteryTotalCount">
                            </el-pagination>
                        </el-card>
                    </el-tab-pane>
                    <el-tab-pane label="订单记录" name="order" v-if="isPermission('customer:viewOrder', user.permissions)">
                        <el-card class="box-card">
                            <el-form :inline="true" label-width="80px">
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="操作时间">
                                            <el-date-picker
                                                    v-model="orderForm.from"
                                                    type="date"
                                                    placeholder="选择日期">
                                            </el-date-picker>&nbsp;至&nbsp;
                                            <el-date-picker
                                                    v-model="orderForm.to"
                                                    type="date"
                                                    placeholder="选择日期">
                                            </el-date-picker>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="状态">
                                            <el-select v-model="orderForm.status" placeholder="请选择状态">
                                                <el-option
                                                        v-for="item in orderTypeList"
                                                        :label="item.name"
                                                        :value="item.value">
                                                </el-option>
                                            </el-select>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <div style="text-align: right">
                                        <el-button type="primary" @click.native.prevent="getOrder">查询</el-button>
                                        <el-button @click.native.prevent="clearOrder">清空查询条件</el-button>
                                    </div>
                                </el-row>
                            </el-form>
                        </el-card>
                        <el-card class="box-card" style="margin-top: 10px">
                            <el-table
                                    :data="orderList"
                                    border
                                    style="width: 100%">
                                <el-table-column
                                        inline-template
                                        label="序号"
                                        width="80">
                                    <div>{{ $index+orderPageSize*(orderCurrentPage-1)+1 }}</div>
                                </el-table-column>
                                <el-table-column
                                        prop="orderCode"
                                        label="订单号">
                                </el-table-column>
                                <el-table-column
                                        prop="statusName"
                                        label="订单状态">
                                </el-table-column>
                                <el-table-column
                                        prop="createTime"
                                        label="下单时间">
                                </el-table-column>
                                <el-table-column
                                        prop="payTime"
                                        label="付款时间">
                                </el-table-column>
                                <el-table-column
                                        prop="amount"
                                        label="订单金额(元)">
                                </el-table-column>
                                <el-table-column
                                        align="center"
                                        label="操作"
                                        inline-template>
                                    <div style="margin-left: -10px">
                                        <el-button size="small" type="primary" @click.native.prevent="toDetail(row.id)">详情</el-button>
                                    </div>
                                </el-table-column>
                            </el-table>
                            <el-pagination
                                    @current-change="handleOrder"
                                    :current-page="orderCurrentPage"
                                    :page-size="orderPageSize"
                                    layout="total, prev, pager, next"
                                    :total="orderTotalCount">
                            </el-pagination>
                        </el-card>
                    </el-tab-pane>
                    <el-tab-pane label="收藏记录" name="favor" v-if="isPermission('customer:viewFav', user.permissions)">
                        <el-card class="box-card" style="margin-top: 10px">
                            <el-table
                                    :data="favorList"
                                    border
                                    style="width: 100%">
                                <el-table-column
                                        inline-template
                                        label="序号"
                                        width="80">
                                    <div>{{ $index+favorPageSize*(favorCurrentPage-1)+1 }}</div>
                                </el-table-column>
                                <el-table-column
                                        prop="itemName"
                                        label="商品"
                                        width="180">
                                </el-table-column>
                                <el-table-column
                                        prop="orgName"
                                        label="商家">
                                </el-table-column>
                                <el-table-column
                                        prop="favorDate"
                                        label="收藏时间">
                                </el-table-column>
                            </el-table>
                            <el-pagination
                                    @current-change="handleFavor"
                                    :current-page="favorCurrentPage"
                                    :page-size="favorPageSize"
                                    layout="total, prev, pager, next"
                                    :total="favorTotalCount">
                            </el-pagination>
                        </el-card>
                    </el-tab-pane>
                    <el-tab-pane label="购物车" name="cart" v-if="isPermission('customer:viewCart', user.permissions)">
                        <el-card class="box-card">
                            <el-table
                                    :data="cartList"
                                    border
                                    style="width: 100%">
                                <el-table-column
                                        inline-template
                                        label="序号"
                                        width="80">
                                    <div>{{ $index+cartPageSize*(cartCurrentPage-1)+1 }}</div>
                                </el-table-column>
                                <el-table-column
                                        prop="itemName"
                                        label="商品"
                                        width="180">
                                </el-table-column>
                                <el-table-column
                                        prop="orgName"
                                        label="商家">
                                </el-table-column>
                                <el-table-column
                                        prop="count"
                                        label="数量">
                                </el-table-column>
                                <el-table-column
                                        prop="addTime"
                                        label="添加时间">
                                </el-table-column>
                            </el-table>
                            <el-pagination
                                    @current-change="handleCart"
                                    :current-page="cartCurrentPage"
                                    :page-size="cartPageSize"
                                    layout="total, prev, pager, next"
                                    :total="cartTotalCount">
                            </el-pagination>
                        </el-card>
                    </el-tab-pane>
                    <el-tab-pane label="分销记录" name="distribution" v-if="isPermission('customer:viewSale', user.permissions)">
                        <el-card class="box-card">
                            <el-form :inline="true" label-width="80px">
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="操作时间">
                                            <el-date-picker
                                                    v-model="distributionForm.from"
                                                    type="date"
                                                    placeholder="选择日期">
                                            </el-date-picker>&nbsp;至&nbsp;
                                            <el-date-picker
                                                    v-model="distributionForm.to"
                                                    type="date"
                                                    placeholder="选择日期">
                                            </el-date-picker>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <div style="text-align: right">
                                        <el-button type="primary" @click.native.prevent="getDistribution">查询</el-button>
                                        <el-button @click.native.prevent="clearDistribution">清空查询条件</el-button>
                                    </div>
                                </el-row>
                            </el-form>
                        </el-card>
                        <el-card class="box-card" style="margin-top: 10px">
                            <el-table
                                    :data="distributionList"
                                    border
                                    style="width: 100%">
                                <el-table-column
                                        inline-template
                                        label="序号"
                                        width="80">
                                    <div>{{ $index+distributionPageSize*(distributionCurrentPage-1)+1 }}</div>
                                </el-table-column>
                                <el-table-column
                                        prop="level"
                                        label="层级">
                                </el-table-column>
                                <el-table-column
                                        prop="num"
                                        label="人数">
                                </el-table-column>
                                <el-table-column
                                        prop="totalMoneyNum"
                                        label="消费总金额">
                                </el-table-column>
                            </el-table>
                            <el-pagination
                                    @current-change="handleDistribution"
                                    :current-page="distributionCurrentPage"
                                    :page-size="distributionPageSize"
                                    layout="total, prev, pager, next"
                                    :total="distributionTotalCount">
                            </el-pagination>
                        </el-card>
                    </el-tab-pane>
                </el-tabs>
                <el-dialog title="赠送积分" v-model="presentPointDialog">
                    <el-form :model="presentForm" label-with="100px">
                        <el-form-item label="赠送积分数">
                            <el-input v-model="presentForm.point" style="width: 200px"></el-input>
                        </el-form-item>
                        <el-form-item label="活动形式">
                            <el-input type="textarea" v-model="presentForm.bizDesc" style="width: 300px"></el-input>
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button @click="clearPresent">取 消</el-button>
                        <el-button type="primary" @click="savePresent">确 定</el-button>
                    </div>
                </el-dialog>
            </div>
            <!-- end content-right -->

            <a href="javascript:;" class="btn-leftMenuFold" id="j-btn-leftMenuFold"></a>
        </div>
    </div>
    <!-- end container -->

    <!--gonggao-->

    <!--tip-->
    <div class="footer">© 2017 , Inc. All rights reserved.</div>
    <!-- end footer -->
    <div class="fixedBar" style="right: -78px;">
        <ul>
            <template v-for="(item, index) in leftMenuList">
                <li v-if="index==0" :class="'shopManager' + index + ' cur'"><a href="javascript:;" :data-target="'#shop_' + index">{{item.groupName}}</a></li>
                <li v-else :class="'shopManager' + index"><a href="javascript:;" :data-target="'#shop_' + index">{{item.groupName}}</a></li>
            </template>
        </ul>
        <a href="javascript:;" class="fixedBar-btn" id="j-fixedBar-btn"></a>
    </div>
    <a href="#" id="j-gotop" class="gotop" title="回到顶部" style="left: 1920.59px;"></a>

</div>
<script src="/static/js/dist/lib-min.js"></script>
<script src="/static/js/dist/list.js"></script>
<script src="/static/js/dist/component-min.js"></script>

<!-- 引入api -->
<script src="/static/js/api.js"></script>
<script>
    new Vue({
        el: '#app',
        mounted: function () {
            this.getDetail();
            this.getInfo();
            this.getAddress();
        },
        data: function(){
            return {
                user: ${(user)!'null'},
                id: ${customerId},
                search: {},
                detail: {},
                activeName: 'info',
                activeName1: 'second',
                presentPointDialog: false,
                cashForm: {
                    from: '',
                    to: '',
                    status: ''
                },
                presentForm: {
                    customerId: '',
                    bizDesc: '',
                    point: ''
                },
                cashCurrentPage: list.customerDetail.currentPage,
                cashPageSize: list.customerDetail.pageSize,
                cashTotalCount: 0,
                cashList: [],
                cashTypeList: [],
                isGetCash: false,
                distributionForm: {
                    from: '',
                    to: ''
                },
                distributionCurrentPage: list.customerDetail.currentPage,
                distributionPageSize: list.customerDetail.pageSize,
                distributionTotalCount: 0,
                isGetDistribution: false,
                distributionList: [],
                favorCurrentPage: list.customerDetail.currentPage,
                favorPageSize: list.customerDetail.pageSize,
                favorTotalCount: 0,
                isGetFavor: false,
                favorList: [],
                cartCurrentPage: list.customerDetail.currentPage,
                cartPageSize: list.customerDetail.pageSize,
                cartTotalCount: 0,
                isGetCart: false,
                cartList: [],
                orderForm: {
                    from: '',
                    to: '',
                    status: ''
                },
                orderCurrentPage: list.customerDetail.currentPage,
                orderPageSize: list.customerDetail.pageSize,
                orderTotalCount: 0,
                isGetOrder: false,
                orderList: [],
                orderTypeList: [],
                signedForm: {
                    from: '',
                    to: ''
                },
                signedCurrentPage: list.customerDetail.currentPage,
                signedPageSize: list.customerDetail.pageSize,
                signedTotalCount: 0,
                signList: [],
                isGetSigned: false,
                lotteryCurrentPage: list.customerDetail.currentPage,
                lotteryPageSize: list.customerDetail.pageSize,
                lotteryTotalCount: 0,
                isGetLottery: false,
                lotteryForm: {
                    from: '',
                    to: ''
                },
                lotteryList: [],
                headerNavList: list.headerNavList,
                accountNavList: list.accountNavList,
                addressPageSize: list.customerDetail.pageSize,
                addressCurrentPage: list.customerDetail.currentPage,
                addressTotalCount: 0,
                mentionsPageSize: list.customerDetail.pageSize,
                mentionsCurrentPage: list.customerDetail.currentPage,
                mentionsTotalCount: 0,
                mentionsList: [],
                pointsCurrentPage: list.customerDetail.currentPage,
                pointsPageSize: list.customerDetail.pageSize,
                pointsTotalCount: 0,
                isGetPoints: false,
                balanceCurrentPage: list.customerDetail.currentPage,
                balancePageSize: list.customerDetail.pageSize,
                balanceTotalCount: 0,
                isGetBalance: false,
                pointsForm: {
                    from: '',
                    to: '',
                    type: ''
                },
                info: {
                    identify: '',
                    point: '',
                    balance: '',
                    subcount: '',
                    dealAmount: '',
                    countPointExchangeBalance: '',
                    countBalanceToCash: '',
                    dealTimes: '',
                    regTime: ''
                },
                leftMenuList: list.menu,
                contactsList: [],
                pointsList: [],
                pointsTypeList: [],
                balanceForm: {
                    from: '',
                    to: '',
                    type: ''
                },
                balanceList: [],
                balanceTypeList: [],
                imgUrl: ''
            }
        },
        methods: {
            formatterAmount (row) {
                return row.operateType === 1 ? '+' + row.amount : '-' + row.amount
            },
            handleAddress (val) {
                this.addressCurrentPage = val
                this.getAddress();
            },
            handleMentions (val) {
                this.mentionsCurrentPage = val
                this.getMentions();
            },
            handlePoints (val) {
                this.pointsCurrentPage = val
                this.getPoints();
            },
            handleBalance (val) {
                this.balanceCurrentPage = val
                this.getBalance();
            },
            handleCash (val) {
                this.cashCurrentPage = val
                this.getCash();
            },
            handleSigned (val) {
                this.signedCurrentPage = val
                this.getSigned();
            },
            handleLottery (val) {
                this.lotteryCurrentPage = val
                this.getLottery();
            },
            handleOrder (val) {
                this.orderCurrentPage = val;
                this.getOrder();
            },
            handleFavor (val) {
                this.favorCurrentPage = val;
                this.getFavor();
            },
            handleCart (val) {
                this.cartCurrentPage = val;
                this.getCart();
            },
            handleDistribution (val) {
                this.distributionCurrentPage = val;
                this.getDistribution();
            },
            handleClick(tab, event) {
                let name = tab.name;
                if (name === "point" && !this.isGetPoints) {
                    this.getType(name);
                    this.getPoints();
                } else if (name === "balance" && !this.isGetBalance) {
                    this.getType(name);
                    this.getBalance();
                } else if (name === "cash" && !this.isGetCash) {
                    this.getType(name);
                    this.getCash();
                } else if (name === "signed" && !this.isGetSigned) {
                    this.getSigned();
                } else if (name === "lottery" && !this.isGetLottery) {
                    this.getLottery();
                } else if (name === "order" && !this.isGetOrder) {
                    this.getType(name);
                    this.getOrder();
                } else if (name === "favor" && !this.isGetFavor) {
                    this.getFavor();
                } else if (name === "cart" && !this.isGetCart) {
                    this.getCart();
                } else if (name === "distribution" && !this.isGetDistribution) {
                    this.getDistribution();
                }
            },
            toDetail (id) {
                window.open('/order/detail?orderId=' + id);
            },
            handleClick1(tab, event) {
                if (tab.name === "third") {
                    this.getMentions();
                }
            },
            formatterTime (row, column) {
                if (row.insertTime !== undefined && (row.insertTime + "").length >= 10) {
                    return (row.insertTime + "").substring(0, 10);
                } else {
                    return row.insertTime;
                }
            },
            formatterBirth (row, column) {
                if (row.birthday !== undefined && (row.birthday + "").length >= 10) {
                    return (row.birthday + "").substring(0, 10);
                } else {
                    return row.birthday;
                }
            },
            getDetail () {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true});
                this.http("/customer/oneCustomer", {customerId: this.id}, function (res) {
                    if (res.status === 200) {
                        that.detail = res.data.currentCustomer;
                        if (res.data.higherCustomerName !== undefined) {
                            that.detail.lastOrg = res.data.higherCustomerName;
                        }
                        if (res.data.higherCustomerTel !== undefined) {
                            that.detail.higherCustomerTel = res.data.higherCustomerTel;
                        }
                        loading.close();
                    } else {
                        loading.close();
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            getInfo () {
                let that = this;
                this.http("/customer/info", {customerId: this.id}, function (res) {
                    if (res.status === 200) {
                        that.imgUrl = res.data.Customer.avatar;
                        that.info =  {
                            identify: res.data.identify !== undefined ? res.data.identify : "",
                            point: res.data.Customer.point !== undefined ? res.data.Customer.point : "",
                            balance: res.data.Customer.balance !== undefined ? res.data.Customer.balance : "",
                            subcount: res.data.Customer.subcount !== undefined ? res.data.Customer.subcount : "",
                            dealAmount: res.data.Customer.dealAmount !== undefined ? res.data.Customer.dealAmount : "",
                            countPointExchangeBalance: res.data.countPointExchangeBalance !== undefined ? res.data.countPointExchangeBalance : "",
                            countBalanceToCash: res.data.countBalanceToCash !== undefined ? res.data.countBalanceToCash : "",
                            dealTimes: res.data.Customer.dealTimes !== undefined ? res.data.Customer.dealTimes : "",
                            regTime: res.data.Customer.regTime !== undefined ? res.data.Customer.regTime : ""
                        }
                    } else {
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            getAddress () {
                let that = this;
                let obj = {
                    customerId: this.id,
                    currentPage: this.addressCurrentPage,
                    pageSize: this.addressPageSize,
                    isAll: 1
                }
                this.http("/customer/address", obj, function (res) {
                    if (res.status === 200) {
                        that.contactsList = res.data.addressList;
                        that.addressTotalCount = res.data.total;
                    } else {
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            getMentions () {
                let that = this;
                let obj = {
                    customerId: this.id,
                    currentPage: this.mentionsCurrentPage,
                    pageSize: this.mentionsPageSize,
                    isAll: 1
                }
                this.http("/customer/mentions", obj, function (res) {
                    if (res.status === 200) {
                        that.mentionsList = res.data.mentionsList;
                        that.mentionsTotalCount = res.data.total;
                    } else {
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            clearPoints () {
                this.pointsForm = {
                    from: '',
                    to: '',
                    type: ''
                };
                this.getPoints();
            },
            getPoints () {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true});
                let obj = {
                    customerId: this.id,
                    from: this.formatTime(this.pointsForm.from, true),
                    to: this.formatTime(this.pointsForm.to, true),
                    type: this.pointsForm.type,
                    currentPage: this.pointsCurrentPage,
                    pageSize: this.pointsPageSize,
                    isAll: 1
                }
                this.http("/customer/points", obj, function (res) {
                    if (res.status === 200) {
                        that.pointsList = res.data.pointList;
                        that.pointsTotalCount = res.data.total;
                        that.isGetPoints = true;
                        loading.close();
                    } else {
                        loading.close();
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            getType (name) {
                let that = this;
                let url = "";
                if (name === "point") {
                    url = "/dictionary/list/MS_POINT_RECORD_BIZ_TYPE";
                } else if (name === "balance") {
                    url = "/dictionary/list/MS_BALANCE_RECORD_TYPE";
                } else if (name === "cash") {
                    url = "/dictionary/list/MS_BALANCE_FETCH_STATUS";
                } else if (name === "order") {
                    url = "/dictionary/list/MS_ORDER_MAIN_STATUS";
                }
                this.$get(url, {}, function (res) {
                    if (res.status === 100) {
                        if (name === "point") {
                            that.pointsTypeList = res.returnValue;
                        } else if (name === "balance") {
                            that.balanceTypeList = res.returnValue;
                        } else if (name === "cash") {
                            that.cashTypeList = res.returnValue;
                        } else if (name === "order") {
                            that.orderTypeList = res.returnValue;
                        }
                    } else {
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            getBalance () {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true});
                let obj = {
                    customerId: this.id,
                    from: this.formatTime(this.balanceForm.from, true),
                    to: this.formatTime(this.balanceForm.to, true),
                    type: this.balanceForm.type,
                    currentPage: this.balanceCurrentPage,
                    pageSize: this.balancePageSize,
                    isAll: 1
                }
                this.http("/customer/balance", obj, function (res) {
                    if (res.status === 200) {
                        that.balanceList = res.data.BalanceList;
                        that.balanceTotalCount = res.data.total;
                        that.isGetBalance = true;
                        loading.close();
                    } else {
                        loading.close();
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            clearBalance () {
                this.balanceForm = {
                    from: '',
                    to: '',
                    type: ''
                }
                this.getBalance();
            },
            getCash () {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true});
                let obj = {
                    customerId: this.id,
                    from: this.formatTime(this.cashForm.from, true),
                    to: this.formatTime(this.cashForm.to, true),
                    type: this.cashForm.type,
                    currentPage: this.cashCurrentPage,
                    pageSize: this.cashPageSize,
                    isAll: 1
                }
                this.http("/customer/balanceFetch", obj, function (res) {
                    if (res.status === 200) {
                        that.cashList = res.data.BalanceFetchList;
                        that.cashTotalCount = res.data.total;
                        that.isGetCash = true;
                        loading.close();
                    } else {
                        loading.close();
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            clearCash () {
                this.cashForm = {
                    from: '',
                    to: '',
                    type: ''
                }
                this.getCash();
            },
            getSigned () {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true});
                let obj = {
                    customerId: this.id,
                    from: this.formatTime(this.signedForm.from, true),
                    to: this.formatTime(this.signedForm.to, true),
                    currentPage: this.signedCurrentPage,
                    pageSize: this.signedPageSize,
                    isAll: 1
                }
                this.http("/customer/signed", obj, function (res) {
                    if (res.status === 200) {
                        that.signList = res.data.signedList;
                        that.signedTotalCount = res.data.total;
                        that.isGetSigned = true;
                        loading.close();
                    } else {
                        loading.close();
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            clearSigned () {
                this.signedForm = {
                    from: '',
                    to: ''
                }
                this.getSigned();
            },
            getLottery () {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true});
                let obj = {
                    customerId: this.id,
                    from: this.formatTime(this.lotteryForm.from, true),
                    to: this.formatTime(this.lotteryForm.to, true),
                    currentPage: this.lotteryCurrentPage,
                    pageSize: this.lotteryPageSize,
                    isAll: 1
                }
                this.http("/customer/lottery", obj, function (res) {
                    if (res.status === 200) {
                        that.lotteryList = res.data.lotteryList;
                        that.lotteryTotalCount = res.data.total;
                        that.isGetLottery = true;
                        loading.close();
                    } else {
                        loading.close();
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            clearLottery () {
                this.lotteryForm = {
                    from: '',
                    to: ''
                }
                this.getLottery();
            },
            getOrder () {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true});
                let obj = {
                    customerId: this.id,
                    from: this.formatTime(this.orderForm.from, true),
                    to: this.formatTime(this.orderForm.to, true),
                    status: this.orderForm.status,
                    currentPage: this.orderCurrentPage,
                    pageSize: this.orderPageSize,
                    isAll: 1
                }
                this.http("/customer/order", obj, function (res) {
                    if (res.status === 200) {
                        that.orderList = res.data.orderList;
                        that.orderTotalCount = res.data.total;
                        that.isGetOrder = true;
                        loading.close();
                    } else {
                        loading.close();
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            clearOrder () {
                this.orderForm = {
                    from: '',
                    to: '',
                    status: ''
                }
                this.getOrder();
            },
            getFavor () {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true});
                let obj = {
                    customerId: this.id,
                    currentPage: this.favorCurrentPage,
                    pageSize: this.favorPageSize,
                    isAll: 1
                }
                this.http("/customer/favor", obj, function (res) {
                    if (res.status === 200) {
                        that.favorList = res.data.favorList;
                        that.favorTotalCount = res.data.total;
                        that.isGetFavor = true;
                        loading.close();
                    } else {
                        loading.close();
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            getCart () {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true});
                let obj = {
                    customerId: this.id,
                    currentPage: this.cartCurrentPage,
                    pageSize: this.cartPageSize,
                    isAll: 1
                }
                this.http("/customer/cart", obj, function (res) {
                    if (res.status === 200) {
                        that.cartList = res.data.cartList;
                        that.cartTotalCount = res.data.total;
                        that.isGetCart = true;
                        loading.close();
                    } else {
                        loading.close();
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            getDistribution () {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true});
                let obj = {
                    id: this.id,
                    from: this.formatTime(this.distributionForm.from, true),
                    to: this.formatTime(this.distributionForm.to, true),
                    currentPage: this.distributionCurrentPage,
                    pageSize: this.distributionPageSize,
                    isAll: 1
                };
                this.http("/customer/distribution", obj, function (res) {
                    if (res.status === 200) {
                        that.distributionList = res.data.distributionList;
                        that.distributionTotalCount = res.data.total;
                        that.isGetDistribution = true;
                        loading.close();
                    } else {
                        loading.close();
                        that.$alert('服务器错误','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('服务器错误','提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            clearDistribution () {
                this.distributionForm = {
                    from: '',
                    to: ''
                };
                this.getDistribution();
            },
            savePresent () {
                let that = this;
                this.presentForm.customerId = this.id;
                this.presentForm.point = parseInt(this.presentForm.point);
                let loading = this.$loading({fullscreen: true, lock: true});
                this.http("/customer/addPresentPoint", this.presentForm, function (res) {
                    if (res.status === 200) {
                        loading.close();
                        that.getPoints();
                        that.clearPresent();
                        that.presentPointDialog = false;
                        that.$alert('赠送成功','提示',{
                            confirmButtonText:'确定',
                        })
                    } else {
                        loading.close();
                        that.$alert('赠送失败','提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    loading.close();
                    that.$alert('赠送失败','提示',{
                        confirmButtonText:'确定'
                    })
                })
            },
            clearPresent () {
                this.presentForm = {
                    customerId: this.id,
                    bizDesc: '',
                    point: ''
                };
                this.presentPointDialog = false;
            }
        }
    })
</script>

<!-- 20170105 --></body>
</html>